{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# tket benchmarking example\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Warning: This notebook is now deprecated for versions from 0.2.0 onwards, and is not going to be updated in ongoing releases.\n",
    "\n",
    "The aim of this example is to show how to run the IBM benchmarking circuits through tket. You will need both `pytket` and `pytket_qiskit` installed from pip before running this turoial. You will also need `pandas` to capture the data.\n",
    "\n",
    "The benchmarking circuits originated from https://github.com/iic-jku/ibm_qx_mapping/tree/master/examples, but there is a copy in pytket in the \"benchmarking\" folder. The initial circuits are written in QASM, meaning that they must be converted to tket's internal representation via Qiskit. Using this script we will compile these circuits through tket and then print a table to terminal containing analysis of the circuits post-compilation.\n",
    "\n",
    "First, begin by importing qiskit and pytket."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "import qiskit\n",
    "import pytket"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We need access to Qiskit's `QuantumCircuit` and the `circuit_to_dag` converter, which will allow us to take the original QASM and retrieve a Qiskit DAGCircuit. There is then a pytket method `dagcircuit_to_tk` to convert this DAGCircuit to tket's internal representation. We also need the pytket method `coupling_to_arc` to convert IBM's architectures to the tket `Architecture` class for the use of routing."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from qiskit import QuantumCircuit\n",
    "\n",
    "from pytket.extensions.qiskit import qiskit_to_tk"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We need all of the required pytket equipment to allow us to perform clean-up transform passes, to route and to analyse the circuits. Lastly, we require the `pandas` module to hold our data, and \n",
    "`time` to benchmark compilation time per circuit."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pytket import Architecture, route\n",
    "from pytket import OpType, Transform\n",
    "import pandas\n",
    "import time"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The architectures used to benchmark for our routing paper were the IBMqx5 and IBMTokyo architectures. The architectures qx5 and Tokyo respectively are shown below (although the diagrams do not show the directedness of the coupling maps). These diagrams are from https://www.research.ibm.com/ibm-q/technology/devices/#ibmqx5. We will now define the coupling map representing both architectures. These will later be converted to directed graphs to be used by tket.\n",
    "![alt text](IBMqx5Arc.png \"Title\")\n",
    "![alt text](IBMTokyoArc.png \"Title2\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "ibm_devices = {\n",
    "    \"ibmqx5\": {\"edges\": [(1, 0), (1, 2), (2, 3), (3, 4), \n",
    "    (3, 14), (5, 4), (6, 5), (6, 7), (6, 11), (7, 10), \n",
    "    (8, 7), (9, 8), (9, 10), (11, 10), (12, 5), (12, 11), \n",
    "    (12, 13), (13, 4), (13, 14), (15, 0), (15, 2), (15, 14)],\n",
    "    \"nodes\": 16},\n",
    "    \"ibmq_20_tokyo\": {\"edges\": [(0, 1), (0, 5), (1, 2), (1, 6), (1, 7), (2, 3), (2, 6),\n",
    "    (2, 7), (3, 4), (3, 8), (3, 9), (4, 8), (4, 9), (5, 6), (5, 10), (5, 11), (6, 7),\n",
    "    (6, 10), (6, 11), (7, 8), (7, 12), (7, 13), (8, 9), (8, 12), (8, 13), (9, 14), (10, 11),\n",
    "    (10, 15), (11, 12), (11, 16), (11, 17), (12, 13), (12, 16), (12, 17), (13, 14), (13, 18),\n",
    "    (13, 19), (14, 18), (14, 19), (15, 16), (16, 17), (17, 18), (18, 19)], \"nodes\": 20}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We shall now choose the device and create a directed graph for tket's routing to use."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "device_name = 'ibmqx5' #'ibm_20_tokyo' ###Note: can also be ran using the Tokyo machine architecture\n",
    "                                       ###      or with a user-defined coupling map\n",
    "coupling_map = ibm_devices[device_name][\"edges\"]\n",
    "directed_arc = Architecture(coupling_map)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We now define a method which takes in (1) a QASM file and (2) a directed graph architecture; it returns analysis of the circuit after our transform passes and routing procedure have been completed. It will also print out to terminal the time taken for all the transformations and routing to finish. Changing which optimisations are run in this method will trade off quality of the ouputs for time taken. For example, removing all optimisation passes and just running the routing procedure will give the fastest run time but may leave some redundant gates in the final circuit."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getStats(filename, directed_arc):\n",
    "    qc = QuantumCircuit.from_qasm_file(filename)\n",
    "    tkcirc = qiskit_to_tk(qc)\n",
    "    start_time = time.process_time()\n",
    "    Transform.OptimisePhaseGadgets().apply(tkcirc)\n",
    "    outcirc = route(tkcirc, directed_arc)\n",
    "    # decompose swaps to CX gates and redirect CXs in wrong direction\n",
    "    outcirc.decompose_SWAP_to_CX()\n",
    "    outcirc.redirect_CX_gates(directed_arc)\n",
    "    Transform.OptimisePostRouting().apply(outcirc)\n",
    "    \n",
    "    time_elapsed = time.process_time() - start_time\n",
    "    \n",
    "    print(\"Compilation time for circuit \" + str(filename) + \": \" + str(time_elapsed) + \"s\")\n",
    "    if outcirc.n_gates==0:\n",
    "        return [0,0,0,0,0]\n",
    "    ###Returns: [number of vertices, circuit depth, nubmer of CX gates, number of parallel slices of CX gates]\n",
    "    return [outcirc.n_gates, outcirc.depth(), outcirc.n_gates_of_type(OpType.CX), \n",
    "            outcirc.depth_by_type(OpType.CX), time_elapsed]\n",
    "    ###Note: the raw number of vertices in the circuits and the raw depth \n",
    "    ###      need to have the i/o vertices removed for fair comparisons"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lastly, we generate the table of input QASM filenames from a csv file using `pandas` and run the circuits through our compiler. The results are printed to terminal by default."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Compilation time for circuit benchmarking/ibmq/xor5_254.qasm: 0.00951000000000013s\n",
      "Time spent compiling so far: 0.00951000000000013\n",
      "Compilation time for circuit benchmarking/ibmq/graycode6_47.qasm: 0.005398000000000014s\n",
      "Time spent compiling so far: 0.014908000000000143\n",
      "Compilation time for circuit benchmarking/ibmq/ex1_226.qasm: 0.008242000000000083s\n",
      "Time spent compiling so far: 0.023150000000000226\n",
      "Compilation time for circuit benchmarking/ibmq/4gt11_84.qasm: 0.015388999999999875s\n",
      "Time spent compiling so far: 0.0385390000000001\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-v0_20.qasm: 0.020800999999999625s\n",
      "Time spent compiling so far: 0.059339999999999726\n",
      "Compilation time for circuit benchmarking/ibmq/ex-1_166.qasm: 0.017431999999999892s\n",
      "Time spent compiling so far: 0.07677199999999962\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-v1_22.qasm: 0.01641899999999996s\n",
      "Time spent compiling so far: 0.09319099999999958\n",
      "Compilation time for circuit benchmarking/ibmq/mod5d1_63.qasm: 0.024310000000000276s\n",
      "Time spent compiling so far: 0.11750099999999986\n",
      "Compilation time for circuit benchmarking/ibmq/ham3_102.qasm: 0.016796000000000255s\n",
      "Time spent compiling so far: 0.1342970000000001\n",
      "Compilation time for circuit benchmarking/ibmq/4gt11_83.qasm: 0.01989099999999988s\n",
      "Time spent compiling so far: 0.154188\n",
      "Compilation time for circuit benchmarking/ibmq/4gt11_82.qasm: 0.024681999999999427s\n",
      "Time spent compiling so far: 0.17886999999999942\n",
      "Compilation time for circuit benchmarking/ibmq/rd32-v0_66.qasm: 0.022649000000000363s\n",
      "Time spent compiling so far: 0.20151899999999978\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v0_27.qasm: 0.031051000000000162s\n",
      "Time spent compiling so far: 0.23256999999999994\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-v1_24.qasm: 0.035730999999999735s\n",
      "Time spent compiling so far: 0.2683009999999997\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-v0_19.qasm: 0.03168000000000015s\n",
      "Time spent compiling so far: 0.29998099999999983\n",
      "Compilation time for circuit benchmarking/ibmq/mod5mils_65.qasm: 0.033256000000000174s\n",
      "Time spent compiling so far: 0.333237\n",
      "Compilation time for circuit benchmarking/ibmq/rd32-v1_68.qasm: 0.03151800000000016s\n",
      "Time spent compiling so far: 0.36475500000000016\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v1_28.qasm: 0.04489699999999974s\n",
      "Time spent compiling so far: 0.4096519999999999\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v2_33.qasm: 0.03587100000000021s\n",
      "Time spent compiling so far: 0.4455230000000001\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v4_37.qasm: 0.032544999999999824s\n",
      "Time spent compiling so far: 0.47806799999999994\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v3_35.qasm: 0.0310940000000004s\n",
      "Time spent compiling so far: 0.5091620000000003\n",
      "Compilation time for circuit benchmarking/ibmq/3_17_13.qasm: 0.03810599999999997s\n",
      "Time spent compiling so far: 0.5472680000000003\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v1_29.qasm: 0.033971000000000195s\n",
      "Time spent compiling so far: 0.5812390000000005\n",
      "Compilation time for circuit benchmarking/ibmq/miller_11.qasm: 0.05386399999999991s\n",
      "Time spent compiling so far: 0.6351030000000004\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v3_34.qasm: 0.06335800000000003s\n",
      "Time spent compiling so far: 0.6984610000000004\n",
      "Compilation time for circuit benchmarking/ibmq/decod24-v2_43.qasm: 0.05558200000000024s\n",
      "Time spent compiling so far: 0.7540430000000007\n",
      "Compilation time for circuit benchmarking/ibmq/decod24-v0_38.qasm: 0.053290000000000504s\n",
      "Time spent compiling so far: 0.8073330000000012\n",
      "Compilation time for circuit benchmarking/ibmq/mod5d2_64.qasm: 0.04377400000000087s\n",
      "Time spent compiling so far: 0.8511070000000021\n",
      "Compilation time for circuit benchmarking/ibmq/4gt13_92.qasm: 0.07327100000000009s\n",
      "Time spent compiling so far: 0.9243780000000021\n",
      "Compilation time for circuit benchmarking/ibmq/4gt13-v1_93.qasm: 0.0683429999999996s\n",
      "Time spent compiling so far: 0.9927210000000017\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-v0_18.qasm: 0.05403900000000039s\n",
      "Time spent compiling so far: 1.0467600000000021\n",
      "Compilation time for circuit benchmarking/ibmq/decod24-bdd_294.qasm: 0.07072400000000023s\n",
      "Time spent compiling so far: 1.1174840000000024\n",
      "Compilation time for circuit benchmarking/ibmq/one-two-three-v2_100.qasm: 0.0743349999999996s\n",
      "Time spent compiling so far: 1.191819000000002\n",
      "Compilation time for circuit benchmarking/ibmq/one-two-three-v3_101.qasm: 0.06547600000000031s\n",
      "Time spent compiling so far: 1.2572950000000023\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-v1_23.qasm: 0.05346799999999963s\n",
      "Time spent compiling so far: 1.310763000000002\n",
      "Compilation time for circuit benchmarking/ibmq/4mod5-bdd_287.qasm: 0.07852100000000029s\n",
      "Time spent compiling so far: 1.3892840000000022\n",
      "Compilation time for circuit benchmarking/ibmq/rd32_270.qasm: 0.061949999999999505s\n",
      "Time spent compiling so far: 1.4512340000000017\n",
      "Compilation time for circuit benchmarking/ibmq/4gt5_75.qasm: 0.0817629999999987s\n",
      "Time spent compiling so far: 1.5329970000000004\n",
      "Compilation time for circuit benchmarking/ibmq/alu-bdd_288.qasm: 0.06410000000000071s\n",
      "Time spent compiling so far: 1.597097000000001\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v0_26.qasm: 0.08118200000000009s\n",
      "Time spent compiling so far: 1.6782790000000012\n",
      "Compilation time for circuit benchmarking/ibmq/decod24-v1_41.qasm: 0.0812450000000009s\n",
      "Time spent compiling so far: 1.759524000000002\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_138.qasm: 0.13351399999999902s\n",
      "Time spent compiling so far: 1.893038000000001\n",
      "Compilation time for circuit benchmarking/ibmq/4gt5_76.qasm: 0.06876499999999997s\n",
      "Time spent compiling so far: 1.961803000000001\n",
      "Compilation time for circuit benchmarking/ibmq/4gt13_91.qasm: 0.08259399999999939s\n",
      "Time spent compiling so far: 2.0443970000000005\n",
      "Compilation time for circuit benchmarking/ibmq/cnt3-5_179.qasm: 0.28147000000000055s\n",
      "Time spent compiling so far: 2.325867000000001\n",
      "Compilation time for circuit benchmarking/ibmq/qft_10.qasm: 0.025814000000000448s\n",
      "Time spent compiling so far: 2.325867000000001\n",
      "Compilation time for circuit benchmarking/ibmq/4gt13_90.qasm: 0.09255399999999803s\n",
      "Time spent compiling so far: 2.418420999999999\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v4_36.qasm: 0.11703999999999937s\n",
      "Time spent compiling so far: 2.5354609999999984\n",
      "Compilation time for circuit benchmarking/ibmq/mini_alu_305.qasm: 0.21232399999999885s\n",
      "Time spent compiling so far: 2.7477849999999973\n",
      "Compilation time for circuit benchmarking/ibmq/ising_model_10.qasm: 0.2612620000000003s\n",
      "Time spent compiling so far: 3.0090469999999976\n",
      "Compilation time for circuit benchmarking/ibmq/ising_model_16.qasm: 0.3769770000000001s\n",
      "Time spent compiling so far: 3.3860239999999977\n",
      "Compilation time for circuit benchmarking/ibmq/ising_model_13.qasm: 0.33491099999999996s\n",
      "Time spent compiling so far: 3.7209349999999977\n",
      "Compilation time for circuit benchmarking/ibmq/4gt5_77.qasm: 0.1293350000000011s\n",
      "Time spent compiling so far: 3.8502699999999987\n",
      "Compilation time for circuit benchmarking/ibmq/sys6-v0_111.qasm: 0.30446699999999893s\n",
      "Time spent compiling so far: 4.154736999999997\n",
      "Compilation time for circuit benchmarking/ibmq/one-two-three-v1_99.qasm: 0.15336699999999936s\n",
      "Time spent compiling so far: 4.308103999999997\n",
      "Compilation time for circuit benchmarking/ibmq/one-two-three-v0_98.qasm: 0.12628400000000006s\n",
      "Time spent compiling so far: 4.434387999999997\n",
      "Compilation time for circuit benchmarking/ibmq/decod24-v3_45.qasm: 0.14908700000000152s\n",
      "Time spent compiling so far: 4.583474999999998\n",
      "Compilation time for circuit benchmarking/ibmq/4gt10-v1_81.qasm: 0.14076600000000106s\n",
      "Time spent compiling so far: 4.724240999999999\n",
      "Compilation time for circuit benchmarking/ibmq/aj-e11_165.qasm: 0.14970000000000105s\n",
      "Time spent compiling so far: 4.873941\n",
      "Compilation time for circuit benchmarking/ibmq/4mod7-v0_94.qasm: 0.16386000000000145s\n",
      "Time spent compiling so far: 5.037801000000002\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v2_32.qasm: 0.15958599999999912s\n",
      "Time spent compiling so far: 5.197387000000001\n",
      "Compilation time for circuit benchmarking/ibmq/rd73_140.qasm: 0.2630720000000011s\n",
      "Time spent compiling so far: 5.460459000000002\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Compilation time for circuit benchmarking/ibmq/4mod7-v1_96.qasm: 0.1598600000000001s\n",
      "Time spent compiling so far: 5.620319000000002\n",
      "Compilation time for circuit benchmarking/ibmq/4gt4-v0_80.qasm: 0.18252500000000182s\n",
      "Time spent compiling so far: 5.802844000000004\n",
      "Compilation time for circuit benchmarking/ibmq/mod10_176.qasm: 0.17993299999999834s\n",
      "Time spent compiling so far: 5.982777000000002\n",
      "Compilation time for circuit benchmarking/ibmq/0410184_169.qasm: 0.6244690000000013s\n",
      "Time spent compiling so far: 6.6072460000000035\n",
      "Compilation time for circuit benchmarking/ibmq/qft_16.qasm: 0.05671399999999949s\n",
      "Time spent compiling so far: 6.6072460000000035\n",
      "Compilation time for circuit benchmarking/ibmq/4gt12-v0_88.qasm: 0.20898000000000394s\n",
      "Time spent compiling so far: 6.8162260000000074\n",
      "Compilation time for circuit benchmarking/ibmq/rd84_142.qasm: 0.7401959999999974s\n",
      "Time spent compiling so far: 7.556422000000005\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_311.qasm: 0.5026390000000021s\n",
      "Time spent compiling so far: 8.059061000000007\n",
      "Compilation time for circuit benchmarking/ibmq/4_49_16.qasm: 0.22887300000000366s\n",
      "Time spent compiling so far: 8.28793400000001\n",
      "Compilation time for circuit benchmarking/ibmq/sym9_146.qasm: 0.5669679999999993s\n",
      "Time spent compiling so far: 8.85490200000001\n",
      "Compilation time for circuit benchmarking/ibmq/4gt12-v1_89.qasm: 0.24625699999999995s\n",
      "Time spent compiling so far: 9.10115900000001\n",
      "Compilation time for circuit benchmarking/ibmq/4gt12-v0_87.qasm: 0.21894999999999598s\n",
      "Time spent compiling so far: 9.320109000000006\n",
      "Compilation time for circuit benchmarking/ibmq/4gt4-v0_79.qasm: 0.19500299999999626s\n",
      "Time spent compiling so far: 9.515112000000002\n",
      "Compilation time for circuit benchmarking/ibmq/hwb4_49.qasm: 0.23632500000000078s\n",
      "Time spent compiling so far: 9.751437000000003\n",
      "Compilation time for circuit benchmarking/ibmq/sym6_316.qasm: 0.6572160000000018s\n",
      "Time spent compiling so far: 10.408653000000005\n",
      "Compilation time for circuit benchmarking/ibmq/4gt12-v0_86.qasm: 0.24052800000000119s\n",
      "Time spent compiling so far: 10.649181000000006\n",
      "Compilation time for circuit benchmarking/ibmq/4gt4-v0_72.qasm: 0.28336000000000183s\n",
      "Time spent compiling so far: 10.932541000000008\n",
      "Compilation time for circuit benchmarking/ibmq/4gt4-v0_78.qasm: 0.2004679999999972s\n",
      "Time spent compiling so far: 11.133009000000005\n",
      "Compilation time for circuit benchmarking/ibmq/mod10_171.qasm: 0.23787799999999848s\n",
      "Time spent compiling so far: 11.370887000000003\n",
      "Compilation time for circuit benchmarking/ibmq/4gt4-v1_74.qasm: 0.28927499999999995s\n",
      "Time spent compiling so far: 11.660162000000003\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_135.qasm: 0.37902099999999805s\n",
      "Time spent compiling so far: 12.039183000000001\n",
      "Compilation time for circuit benchmarking/ibmq/mini-alu_167.qasm: 0.28952900000000525s\n",
      "Time spent compiling so far: 12.328712000000007\n",
      "Compilation time for circuit benchmarking/ibmq/one-two-three-v0_97.qasm: 0.32423s\n",
      "Time spent compiling so far: 12.652942000000007\n",
      "Compilation time for circuit benchmarking/ibmq/ham7_104.qasm: 0.37469400000000164s\n",
      "Time spent compiling so far: 13.027636000000008\n",
      "Compilation time for circuit benchmarking/ibmq/decod24-enable_126.qasm: 0.37364900000000034s\n",
      "Time spent compiling so far: 13.401285000000009\n",
      "Compilation time for circuit benchmarking/ibmq/mod8-10_178.qasm: 0.43175500000000255s\n",
      "Time spent compiling so far: 13.833040000000011\n",
      "Compilation time for circuit benchmarking/ibmq/cnt3-5_180.qasm: 2.2587930000000043s\n",
      "Time spent compiling so far: 16.091833000000015\n",
      "Compilation time for circuit benchmarking/ibmq/ex3_229.qasm: 0.4237730000000006s\n",
      "Time spent compiling so far: 16.515606000000016\n",
      "Compilation time for circuit benchmarking/ibmq/4gt4-v0_73.qasm: 0.4361159999999984s\n",
      "Time spent compiling so far: 16.951722000000014\n",
      "Compilation time for circuit benchmarking/ibmq/mod8-10_177.qasm: 0.4928449999999991s\n",
      "Time spent compiling so far: 17.444567000000013\n",
      "Compilation time for circuit benchmarking/ibmq/C17_204.qasm: 0.6808130000000006s\n",
      "Time spent compiling so far: 18.125380000000014\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v2_31.qasm: 0.465876999999999s\n",
      "Time spent compiling so far: 18.591257000000013\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_131.qasm: 0.6336799999999982s\n",
      "Time spent compiling so far: 19.22493700000001\n",
      "Compilation time for circuit benchmarking/ibmq/alu-v2_30.qasm: 0.5685000000000002s\n",
      "Time spent compiling so far: 19.79343700000001\n",
      "Compilation time for circuit benchmarking/ibmq/mod5adder_127.qasm: 0.5798150000000035s\n",
      "Time spent compiling so far: 20.373252000000015\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_133.qasm: 0.7312700000000021s\n",
      "Time spent compiling so far: 21.104522000000017\n",
      "Compilation time for circuit benchmarking/ibmq/cm82a_208.qasm: 0.7972960000000029s\n",
      "Time spent compiling so far: 21.90181800000002\n",
      "Compilation time for circuit benchmarking/ibmq/majority_239.qasm: 0.7681219999999982s\n",
      "Time spent compiling so far: 22.669940000000018\n",
      "Compilation time for circuit benchmarking/ibmq/ex2_227.qasm: 0.7928779999999946s\n",
      "Time spent compiling so far: 23.462818000000013\n",
      "Compilation time for circuit benchmarking/ibmq/sf_276.qasm: 0.8383489999999938s\n",
      "Time spent compiling so far: 24.301167000000007\n",
      "Compilation time for circuit benchmarking/ibmq/sf_274.qasm: 0.8409819999999968s\n",
      "Time spent compiling so far: 25.142149000000003\n",
      "Compilation time for circuit benchmarking/ibmq/con1_216.qasm: 1.661089000000004s\n",
      "Time spent compiling so far: 26.803238000000007\n",
      "Compilation time for circuit benchmarking/ibmq/wim_266.qasm: 4.542246999999996s\n",
      "Time spent compiling so far: 31.345485000000004\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_130.qasm: 1.323321s\n",
      "Time spent compiling so far: 32.668806000000004\n",
      "Compilation time for circuit benchmarking/ibmq/f2_232.qasm: 1.946520999999997s\n",
      "Time spent compiling so far: 34.615327\n",
      "Compilation time for circuit benchmarking/ibmq/cm152a_212.qasm: 3.305444999999999s\n",
      "Time spent compiling so far: 37.920772\n",
      "Compilation time for circuit benchmarking/ibmq/rd53_251.qasm: 1.9612180000000023s\n",
      "Time spent compiling so far: 39.88199\n",
      "Compilation time for circuit benchmarking/ibmq/hwb5_53.qasm: 1.4080020000000033s\n",
      "Time spent compiling so far: 41.289992000000005\n",
      "Compilation time for circuit benchmarking/ibmq/cm42a_207.qasm: 25.442768s\n",
      "Time spent compiling so far: 66.73276000000001\n",
      "Compilation time for circuit benchmarking/ibmq/pm1_249.qasm: 23.057216999999994s\n",
      "Time spent compiling so far: 89.78997700000001\n",
      "Compilation time for circuit benchmarking/ibmq/dc1_220.qasm: 11.941876999999991s\n",
      "Time spent compiling so far: 101.731854\n",
      "Compilation time for circuit benchmarking/ibmq/squar5_261.qasm: 8.14356699999999s\n",
      "Time spent compiling so far: 109.87542099999999\n",
      "Compilation time for circuit benchmarking/ibmq/z4_268.qasm: 11.094992999999988s\n",
      "Time spent compiling so far: 120.97041399999998\n",
      "Compilation time for circuit benchmarking/ibmq/sqrt8_260.qasm: 12.300466s\n",
      "Time spent compiling so far: 133.27087999999998\n",
      "Compilation time for circuit benchmarking/ibmq/radd_250.qasm: 26.233103999999997s\n",
      "Time spent compiling so far: 159.50398399999997\n",
      "Compilation time for circuit benchmarking/ibmq/adr4_197.qasm: 46.54046200000002s\n",
      "Time spent compiling so far: 206.044446\n",
      "Compilation time for circuit benchmarking/ibmq/sym6_145.qasm: 5.235140999999942s\n",
      "Time spent compiling so far: 211.27958699999994\n",
      "Compilation time for circuit benchmarking/ibmq/misex1_241.qasm: 57.77592099999998s\n",
      "Time spent compiling so far: 269.0555079999999\n",
      "Compilation time for circuit benchmarking/ibmq/rd73_252.qasm: 14.12543599999998s\n",
      "Time spent compiling so far: 283.1809439999999\n",
      "Compilation time for circuit benchmarking/ibmq/cycle10_2_110.qasm: 28.728320000000053s\n",
      "Time spent compiling so far: 311.90926399999995\n",
      "Compilation time for circuit benchmarking/ibmq/hwb6_56.qasm: 9.68947600000007s\n",
      "Time spent compiling so far: 321.59874\n",
      "Compilation time for circuit benchmarking/ibmq/square_root_7.qasm: 64.69754600000005s\n",
      "Time spent compiling so far: 386.29628600000007\n",
      "Compilation time for circuit benchmarking/ibmq/ham15_107.qasm: 588.933307s\n",
      "Time spent compiling so far: 975.229593\n",
      "Compilation time for circuit benchmarking/ibmq/dc2_222.qasm: 61.593504000000166s\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time spent compiling so far: 1036.8230970000002\n",
      "Compilation time for circuit benchmarking/ibmq/sqn_258.qasm: 28.884308000000146s\n",
      "Time spent compiling so far: 1065.7074050000003\n",
      "Compilation time for circuit benchmarking/ibmq/inc_237.qasm: 106.20392800000013s\n",
      "Time spent compiling so far: 1171.9113330000005\n",
      "Compilation time for circuit benchmarking/ibmq/cm85a_209.qasm: 89.76953500000013s\n",
      "Time spent compiling so far: 1261.6808680000006\n",
      "Compilation time for circuit benchmarking/ibmq/rd84_253.qasm: 66.61587499999996s\n",
      "Time spent compiling so far: 1328.2967430000006\n",
      "Compilation time for circuit benchmarking/ibmq/co14_215.qasm: 128.39122300000008s\n",
      "Time spent compiling so far: 1456.6879660000006\n",
      "Compilation time for circuit benchmarking/ibmq/root_255.qasm: 123.82956399999989s\n",
      "Time spent compiling so far: 1580.5175300000005\n",
      "Compilation time for circuit benchmarking/ibmq/mlp4_245.qasm: 242.6016039999995s\n",
      "Time spent compiling so far: 1823.119134\n",
      "Compilation time for circuit benchmarking/ibmq/urf2_277.qasm: 33.63925399999971s\n",
      "Time spent compiling so far: 1856.7583879999997\n",
      "Compilation time for circuit benchmarking/ibmq/sym9_148.qasm: 64.92562999999973s\n",
      "Time spent compiling so far: 1921.6840179999995\n",
      "Compilation time for circuit benchmarking/ibmq/life_238.qasm: 73.87741500000038s\n",
      "Time spent compiling so far: 1995.5614329999999\n",
      "Compilation time for circuit benchmarking/ibmq/hwb7_59.qasm: 40.89143699999977s\n",
      "Time spent compiling so far: 2036.4528699999996\n",
      "Compilation time for circuit benchmarking/ibmq/max46_240.qasm: 69.40681099999983s\n",
      "Time spent compiling so far: 2105.8596809999995\n",
      "Compilation time for circuit benchmarking/ibmq/clip_206.qasm: 284.1277840000007s\n",
      "Time spent compiling so far: 2389.987465\n",
      "Compilation time for circuit benchmarking/ibmq/9symml_195.qasm: 112.6734349999997s\n",
      "Time spent compiling so far: 2502.6609\n",
      "Compilation time for circuit benchmarking/ibmq/sym9_193.qasm: 112.30117599999949s\n",
      "Time spent compiling so far: 2614.9620759999993\n",
      "Compilation time for circuit benchmarking/ibmq/sao2_257.qasm: 270.47973500000035s\n",
      "Time spent compiling so far: 2885.4418109999997\n",
      "Compilation time for circuit benchmarking/ibmq/dist_223.qasm: 250.32260099999985s\n",
      "Time spent compiling so far: 3135.7644119999995\n",
      "Compilation time for circuit benchmarking/ibmq/urf5_280.qasm: 110.69195600000057s\n",
      "Time spent compiling so far: 3246.456368\n",
      "Compilation time for circuit benchmarking/ibmq/urf1_278.qasm: 124.18942200000038s\n",
      "Time spent compiling so far: 3370.6457900000005\n",
      "Compilation time for circuit benchmarking/ibmq/sym10_262.qasm: 302.3636999999999s\n",
      "Time spent compiling so far: 3673.0094900000004\n",
      "Compilation time for circuit benchmarking/ibmq/hwb8_113.qasm: 154.02841999999964s\n",
      "Time spent compiling so far: 3827.03791\n",
      "Compilation time for circuit benchmarking/ibmq/urf2_152.qasm: 151.88721200000055s\n",
      "Time spent compiling so far: 3978.9251220000006\n",
      "Compilation time for circuit benchmarking/ibmq/urf3_279.qasm: 370.62564999999995s\n",
      "Time spent compiling so far: 4349.5507720000005\n",
      "Compilation time for circuit benchmarking/ibmq/plus63mod4096_163.qasm: 830.132912s\n",
      "Time spent compiling so far: 5179.6836840000005\n",
      "Compilation time for circuit benchmarking/ibmq/urf5_158.qasm: 447.08807799999977s\n",
      "Time spent compiling so far: 5626.771762\n",
      "Compilation time for circuit benchmarking/ibmq/urf6_160.qasm: 1869.587466s\n",
      "Time spent compiling so far: 7496.359228\n",
      "Compilation time for circuit benchmarking/ibmq/urf1_149.qasm: 498.8691209999997s\n",
      "Time spent compiling so far: 7995.228349\n",
      "Compilation time for circuit benchmarking/ibmq/plus63mod8192_164.qasm: 1486.8815559999985s\n",
      "Time spent compiling so far: 9482.109904999998\n",
      "Compilation time for circuit benchmarking/ibmq/hwb9_119.qasm: 618.8746800000008s\n",
      "Time spent compiling so far: 10100.984584999998\n",
      "Compilation time for circuit benchmarking/ibmq/urf3_155.qasm: 1497.5685780000003s\n",
      "Time spent compiling so far: 11598.553162999999\n",
      "Compilation time for circuit benchmarking/ibmq/ground_state_estimation_10.qasm: 142.17033999999876s\n",
      "Time spent compiling so far: 11740.723502999997\n",
      "Compilation time for circuit benchmarking/ibmq/urf4_187.qasm: 1895.1665990000001s\n",
      "Time spent compiling so far: 13635.890101999998\n",
      "                                 Size out  Depth out  CX count out  \\\n",
      "xor5_254.qasm                          25         14             8   \n",
      "graycode6_47.qasm                      13          9             5   \n",
      "ex1_226.qasm                           25         14             8   \n",
      "4gt11_84.qasm                          50         32            18   \n",
      "4mod5-v0_20.qasm                       50         30            19   \n",
      "ex-1_166.qasm                          52         34            18   \n",
      "4mod5-v1_22.qasm                       54         32            20   \n",
      "mod5d1_63.qasm                         63         39            25   \n",
      "ham3_102.qasm                          53         36            19   \n",
      "4gt11_83.qasm                          76         47            29   \n",
      "4gt11_82.qasm                          95         57            36   \n",
      "rd32-v0_66.qasm                        75         51            27   \n",
      "alu-v0_27.qasm                        104         61            38   \n",
      "4mod5-v1_24.qasm                       89         57            37   \n",
      "4mod5-v0_19.qasm                      108         71            37   \n",
      "mod5mils_65.qasm                       92         65            34   \n",
      "rd32-v1_68.qasm                        75         51            27   \n",
      "alu-v1_28.qasm                        108         67            39   \n",
      "alu-v2_33.qasm                         95         58            35   \n",
      "alu-v4_37.qasm                        100         57            39   \n",
      "alu-v3_35.qasm                        100         57            39   \n",
      "3_17_13.qasm                           86         59            35   \n",
      "alu-v1_29.qasm                        103         61            38   \n",
      "miller_11.qasm                        138         90            50   \n",
      "alu-v3_34.qasm                        136         90            54   \n",
      "decod24-v2_43.qasm                    131         85            49   \n",
      "decod24-v0_38.qasm                    127         82            48   \n",
      "mod5d2_64.qasm                        145         93            58   \n",
      "4gt13_92.qasm                         169        109            63   \n",
      "4gt13-v1_93.qasm                      174        115            66   \n",
      "4mod5-v0_18.qasm                      180        119            70   \n",
      "decod24-bdd_294.qasm                  179        118            69   \n",
      "one-two-three-v2_100.qasm             175        112            68   \n",
      "one-two-three-v3_101.qasm             197        132            72   \n",
      "4mod5-v1_23.qasm                      187        123            74   \n",
      "4mod5-bdd_287.qasm                    193        124            70   \n",
      "rd32_270.qasm                         219        145            84   \n",
      "4gt5_75.qasm                          220        140            83   \n",
      "alu-bdd_288.qasm                      221        144            83   \n",
      "alu-v0_26.qasm                        226        143            83   \n",
      "decod24-v1_41.qasm                    216        140            83   \n",
      "rd53_138.qasm                         365        185           138   \n",
      "4gt5_76.qasm                          254        173            97   \n",
      "4gt13_91.qasm                         281        190           104   \n",
      "cnt3-5_179.qasm                       557        242           211   \n",
      "qft_10.qasm                             0          0             0   \n",
      "4gt13_90.qasm                         302        203           111   \n",
      "alu-v4_36.qasm                        290        187           109   \n",
      "mini_alu_305.qasm                     476        220           183   \n",
      "ising_model_10.qasm                   210         41            90   \n",
      "ising_model_16.qasm                   372         41           150   \n",
      "ising_model_13.qasm                   307         41           120   \n",
      "4gt5_77.qasm                          329        210           124   \n",
      "sys6-v0_111.qasm                      618        286           236   \n",
      "one-two-three-v1_99.qasm              360        239           134   \n",
      "one-two-three-v0_98.qasm              367        248           140   \n",
      "decod24-v3_45.qasm                    374        244           139   \n",
      "4gt10-v1_81.qasm                      374        250           144   \n",
      "aj-e11_165.qasm                       394        269           150   \n",
      "4mod7-v0_94.qasm                      434        290           162   \n",
      "alu-v2_32.qasm                        427        279           162   \n",
      "rd73_140.qasm                         638        296           245   \n",
      "4mod7-v1_96.qasm                      391        263           151   \n",
      "4gt4-v0_80.qasm                       450        297           172   \n",
      "mod10_176.qasm                        452        291           174   \n",
      "0410184_169.qasm                      738        349           289   \n",
      "qft_16.qasm                             0          0             0   \n",
      "4gt12-v0_88.qasm                      553        336           212   \n",
      "rd84_142.qasm                        1081        464           415   \n",
      "rd53_311.qasm                         870        457           339   \n",
      "4_49_16.qasm                          607        400           226   \n",
      "sym9_146.qasm                         936        446           358   \n",
      "4gt12-v1_89.qasm                      568        362           217   \n",
      "4gt12-v0_87.qasm                      621        392           235   \n",
      "4gt4-v0_79.qasm                       572        374           220   \n",
      "hwb4_49.qasm                          605        395           228   \n",
      "sym6_316.qasm                         859        460           334   \n",
      "4gt12-v0_86.qasm                      636        407           242   \n",
      "4gt4-v0_72.qasm                       657        400           254   \n",
      "4gt4-v0_78.qasm                       594        389           227   \n",
      "mod10_171.qasm                        626        413           240   \n",
      "4gt4-v1_74.qasm                       690        455           272   \n",
      "rd53_135.qasm                         846        522           324   \n",
      "mini-alu_167.qasm                     740        487           285   \n",
      "one-two-three-v0_97.qasm              763        522           294   \n",
      "ham7_104.qasm                         884        546           343   \n",
      "decod24-enable_126.qasm               922        593           353   \n",
      "mod8-10_178.qasm                     1013        676           386   \n",
      "cnt3-5_180.qasm                      1393        736           539   \n",
      "ex3_229.qasm                         1048        667           406   \n",
      "4gt4-v0_73.qasm                      1074        720           414   \n",
      "mod8-10_177.qasm                     1140        733           445   \n",
      "C17_204.qasm                         1377        876           536   \n",
      "alu-v2_31.qasm                       1159        751           441   \n",
      "rd53_131.qasm                        1250        763           480   \n",
      "alu-v2_30.qasm                       1402        906           546   \n",
      "mod5adder_127.qasm                   1538        957           581   \n",
      "rd53_133.qasm                        1592        979           612   \n",
      "cm82a_208.qasm                       1757       1040           681   \n",
      "majority_239.qasm                    1653       1026           633   \n",
      "ex2_227.qasm                         1725       1086           659   \n",
      "sf_276.qasm                          1975       1308           768   \n",
      "sf_274.qasm                          1993       1323           765   \n",
      "con1_216.qasm                        2857       1794          1121   \n",
      "wim_266.qasm                         2819       1678          1099   \n",
      "rd53_130.qasm                        2815       1753          1096   \n",
      "f2_232.qasm                          3427       2266          1325   \n",
      "cm152a_212.qasm                      3453       2186          1347   \n",
      "rd53_251.qasm                        3758       2368          1429   \n",
      "hwb5_53.qasm                         3713       2401          1432   \n",
      "cm42a_207.qasm                       5181       3014          2007   \n",
      "pm1_249.qasm                         5181       3014          2007   \n",
      "dc1_220.qasm                         5917       3684          2315   \n",
      "squar5_261.qasm                      6377       3854          2492   \n",
      "z4_268.qasm                          9164       5471          3563   \n",
      "sqrt8_260.qasm                       9106       5562          3542   \n",
      "radd_250.qasm                        9462       5688          3661   \n",
      "adr4_197.qasm                       10357       6055          4030   \n",
      "sym6_145.qasm                       10756       6805          4164   \n",
      "misex1_241.qasm                     14534       8925          5673   \n",
      "rd73_252.qasm                       15976       9680          6181   \n",
      "cycle10_2_110.qasm                  18487      11440          7252   \n",
      "hwb6_56.qasm                        18550      11834          7135   \n",
      "square_root_7.qasm                  22470      13158          8947   \n",
      "ham15_107.qasm                      25862      15757          9989   \n",
      "dc2_222.qasm                        29882      18173         11657   \n",
      "sqn_258.qasm                        30036      18448         11709   \n",
      "inc_237.qasm                        32472      19886         12766   \n",
      "cm85a_209.qasm                      35446      22104         13930   \n",
      "rd84_253.qasm                       40724      24005         15882   \n",
      "co14_215.qasm                       56374      30524         21896   \n",
      "root_255.qasm                       52615      30655         20482   \n",
      "mlp4_245.qasm                       59832      36288         23318   \n",
      "urf2_277.qasm                       66948      39434         26327   \n",
      "sym9_148.qasm                       62586      39228         24363   \n",
      "life_238.qasm                       68359      41635         26538   \n",
      "hwb7_59.qasm                        69520      43352         27136   \n",
      "max46_240.qasm                      79067      46649         30769   \n",
      "clip_206.qasm                      104519      61937         40950   \n",
      "9symml_195.qasm                    104299      63616         40686   \n",
      "sym9_193.qasm                      104299      63616         40686   \n",
      "sao2_257.qasm                      121374      69339         47336   \n",
      "dist_223.qasm                      118143      69156         46178   \n",
      "urf5_280.qasm                      154799      92851         60653   \n",
      "urf1_278.qasm                      176029     104865         69267   \n",
      "sym10_262.qasm                     200584     121977         78116   \n",
      "hwb8_113.qasm                      200371     124411         77790   \n",
      "urf2_152.qasm                      225731     144286         87475   \n",
      "urf3_279.qasm                      418175     246943        164373   \n",
      "plus63mod4096_163.qasm             397164     243811        155060   \n",
      "urf5_158.qasm                      456435     286537        177850   \n",
      "urf6_160.qasm                      537153     314319        210332   \n",
      "urf1_149.qasm                      518233     318657        201568   \n",
      "plus63mod8192_164.qasm             584830     359000        228069   \n",
      "hwb9_119.qasm                      616748     382737        239876   \n",
      "urf3_155.qasm                     1219715     751497        475140   \n",
      "ground_state_estimation_10.qasm        15          7             3   \n",
      "urf4_187.qasm                     1513171     893289        586910   \n",
      "\n",
      "                                 CX depth out      Runtime  \n",
      "xor5_254.qasm                               8     0.009510  \n",
      "graycode6_47.qasm                           5     0.005398  \n",
      "ex1_226.qasm                                8     0.008242  \n",
      "4gt11_84.qasm                              18     0.015389  \n",
      "4mod5-v0_20.qasm                           18     0.020801  \n",
      "ex-1_166.qasm                              18     0.017432  \n",
      "4mod5-v1_22.qasm                           19     0.016419  \n",
      "mod5d1_63.qasm                             22     0.024310  \n",
      "ham3_102.qasm                              19     0.016796  \n",
      "4gt11_83.qasm                              27     0.019891  \n",
      "4gt11_82.qasm                              32     0.024682  \n",
      "rd32-v0_66.qasm                            27     0.022649  \n",
      "alu-v0_27.qasm                             33     0.031051  \n",
      "4mod5-v1_24.qasm                           35     0.035731  \n",
      "4mod5-v0_19.qasm                           37     0.031680  \n",
      "mod5mils_65.qasm                           34     0.033256  \n",
      "rd32-v1_68.qasm                            27     0.031518  \n",
      "alu-v1_28.qasm                             35     0.044897  \n",
      "alu-v2_33.qasm                             31     0.035871  \n",
      "alu-v4_37.qasm                             34     0.032545  \n",
      "alu-v3_35.qasm                             34     0.031094  \n",
      "3_17_13.qasm                               35     0.038106  \n",
      "alu-v1_29.qasm                             33     0.033971  \n",
      "miller_11.qasm                             50     0.053864  \n",
      "alu-v3_34.qasm                             53     0.063358  \n",
      "decod24-v2_43.qasm                         49     0.055582  \n",
      "decod24-v0_38.qasm                         48     0.053290  \n",
      "mod5d2_64.qasm                             56     0.043774  \n",
      "4gt13_92.qasm                              58     0.073271  \n",
      "4gt13-v1_93.qasm                           62     0.068343  \n",
      "4mod5-v0_18.qasm                           70     0.054039  \n",
      "decod24-bdd_294.qasm                       68     0.070724  \n",
      "one-two-three-v2_100.qasm                  64     0.074335  \n",
      "one-two-three-v3_101.qasm                  70     0.065476  \n",
      "4mod5-v1_23.qasm                           72     0.053468  \n",
      "4mod5-bdd_287.qasm                         69     0.078521  \n",
      "rd32_270.qasm                              82     0.061950  \n",
      "4gt5_75.qasm                               78     0.081763  \n",
      "alu-bdd_288.qasm                           80     0.064100  \n",
      "alu-v0_26.qasm                             78     0.081182  \n",
      "decod24-v1_41.qasm                         79     0.081245  \n",
      "rd53_138.qasm                             103     0.133514  \n",
      "4gt5_76.qasm                               93     0.068765  \n",
      "4gt13_91.qasm                             101     0.082594  \n",
      "cnt3-5_179.qasm                           134     0.281470  \n",
      "qft_10.qasm                                 0     0.000000  \n",
      "4gt13_90.qasm                             108     0.092554  \n",
      "alu-v4_36.qasm                            104     0.117040  \n",
      "mini_alu_305.qasm                         125     0.212324  \n",
      "ising_model_10.qasm                        20     0.261262  \n",
      "ising_model_16.qasm                        20     0.376977  \n",
      "ising_model_13.qasm                        20     0.334911  \n",
      "4gt5_77.qasm                              117     0.129335  \n",
      "sys6-v0_111.qasm                          159     0.304467  \n",
      "one-two-three-v1_99.qasm                  131     0.153367  \n",
      "one-two-three-v0_98.qasm                  135     0.126284  \n",
      "decod24-v3_45.qasm                        133     0.149087  \n",
      "4gt10-v1_81.qasm                          140     0.140766  \n",
      "aj-e11_165.qasm                           145     0.149700  \n",
      "4mod7-v0_94.qasm                          158     0.163860  \n",
      "alu-v2_32.qasm                            155     0.159586  \n",
      "rd73_140.qasm                             166     0.263072  \n",
      "4mod7-v1_96.qasm                          145     0.159860  \n",
      "4gt4-v0_80.qasm                           163     0.182525  \n",
      "mod10_176.qasm                            163     0.179933  \n",
      "0410184_169.qasm                          196     0.624469  \n",
      "qft_16.qasm                                 0     0.000000  \n",
      "4gt12-v0_88.qasm                          188     0.208980  \n",
      "rd84_142.qasm                             258     0.740196  \n",
      "rd53_311.qasm                             254     0.502639  \n",
      "4_49_16.qasm                              218     0.228873  \n",
      "sym9_146.qasm                             252     0.566968  \n",
      "4gt12-v1_89.qasm                          203     0.246257  \n",
      "4gt12-v0_87.qasm                          215     0.218950  \n",
      "4gt4-v0_79.qasm                           208     0.195003  \n",
      "hwb4_49.qasm                              217     0.236325  \n",
      "sym6_316.qasm                             257     0.657216  \n",
      "4gt12-v0_86.qasm                          223     0.240528  \n",
      "4gt4-v0_72.qasm                           227     0.283360  \n",
      "4gt4-v0_78.qasm                           216     0.200468  \n",
      "mod10_171.qasm                            228     0.237878  \n",
      "4gt4-v1_74.qasm                           261     0.289275  \n",
      "rd53_135.qasm                             291     0.379021  \n",
      "mini-alu_167.qasm                         267     0.289529  \n",
      "one-two-three-v0_97.qasm                  289     0.324230  \n",
      "ham7_104.qasm                             312     0.374694  \n",
      "decod24-enable_126.qasm                   333     0.373649  \n",
      "mod8-10_178.qasm                          367     0.431755  \n",
      "cnt3-5_180.qasm                           410     2.258793  \n",
      "ex3_229.qasm                              372     0.423773  \n",
      "4gt4-v0_73.qasm                           394     0.436116  \n",
      "mod8-10_177.qasm                          416     0.492845  \n",
      "C17_204.qasm                              486     0.680813  \n",
      "alu-v2_31.qasm                            415     0.465877  \n",
      "rd53_131.qasm                             432     0.633680  \n",
      "alu-v2_30.qasm                            504     0.568500  \n",
      "mod5adder_127.qasm                        536     0.579815  \n",
      "rd53_133.qasm                             553     0.731270  \n",
      "cm82a_208.qasm                            579     0.797296  \n",
      "majority_239.qasm                         565     0.768122  \n",
      "ex2_227.qasm                              604     0.792878  \n",
      "sf_276.qasm                               734     0.838349  \n",
      "sf_274.qasm                               732     0.840982  \n",
      "con1_216.qasm                             993     1.661089  \n",
      "wim_266.qasm                              934     4.542247  \n",
      "rd53_130.qasm                             980     1.323321  \n",
      "f2_232.qasm                              1237     1.946521  \n",
      "cm152a_212.qasm                          1225     3.305445  \n",
      "rd53_251.qasm                            1290     1.961218  \n",
      "hwb5_53.qasm                             1352     1.408002  \n",
      "cm42a_207.qasm                           1694    25.442768  \n",
      "pm1_249.qasm                             1694    23.057217  \n",
      "dc1_220.qasm                             2045    11.941877  \n",
      "squar5_261.qasm                          2161     8.143567  \n",
      "z4_268.qasm                              3030    11.094993  \n",
      "sqrt8_260.qasm                           3093    12.300466  \n",
      "radd_250.qasm                            3167    26.233104  \n",
      "adr4_197.qasm                            3382    46.540462  \n",
      "sym6_145.qasm                            3819     5.235141  \n",
      "misex1_241.qasm                          4974    57.775921  \n",
      "rd73_252.qasm                            5373    14.125436  \n",
      "cycle10_2_110.qasm                       6397    28.728320  \n",
      "hwb6_56.qasm                             6513     9.689476  \n",
      "square_root_7.qasm                       7446    64.697546  \n",
      "ham15_107.qasm                           8728   588.933307  \n",
      "dc2_222.qasm                            10098    61.593504  \n",
      "sqn_258.qasm                            10273    28.884308  \n",
      "inc_237.qasm                            11140   106.203928  \n",
      "cm85a_209.qasm                          12366    89.769535  \n",
      "rd84_253.qasm                           13405    66.615875  \n",
      "co14_215.qasm                           17008   128.391223  \n",
      "root_255.qasm                           17076   123.829564  \n",
      "mlp4_245.qasm                           20258   242.601604  \n",
      "urf2_277.qasm                           22099    33.639254  \n",
      "sym9_148.qasm                           21805    64.925630  \n",
      "life_238.qasm                           23121    73.877415  \n",
      "hwb7_59.qasm                            24091    40.891437  \n",
      "max46_240.qasm                          26016    69.406811  \n",
      "clip_206.qasm                           34520   284.127784  \n",
      "9symml_195.qasm                         35437   112.673435  \n",
      "sym9_193.qasm                           35437   112.301176  \n",
      "sao2_257.qasm                           38642   270.479735  \n",
      "dist_223.qasm                           38660   250.322601  \n",
      "urf5_280.qasm                           51913   110.691956  \n",
      "urf1_278.qasm                           58728   124.189422  \n",
      "sym10_262.qasm                          68141   302.363700  \n",
      "hwb8_113.qasm                           69065   154.028420  \n",
      "urf2_152.qasm                           79903   151.887212  \n",
      "urf3_279.qasm                          138114   370.625650  \n",
      "plus63mod4096_163.qasm                 136210   830.132912  \n",
      "urf5_158.qasm                          159416   447.088078  \n",
      "urf6_160.qasm                          175227  1869.587466  \n",
      "urf1_149.qasm                          179176   498.869121  \n",
      "plus63mod8192_164.qasm                 200254  1486.881556  \n",
      "hwb9_119.qasm                          211857   618.874680  \n",
      "urf3_155.qasm                          418559  1497.568578  \n",
      "ground_state_estimation_10.qasm             3   142.170340  \n",
      "urf4_187.qasm                          494739  1895.166599  \n"
     ]
    }
   ],
   "source": [
    "test_table = pandas.read_csv(\"benchmarking/IBMQConfig.csv\",index_col=0)\n",
    "test_table = test_table.sort_values(by='Depth in')\n",
    "\n",
    "stat_table = pandas.DataFrame({})\n",
    "total_time = 0\n",
    "\n",
    "for i, (index, row) in enumerate(test_table.iterrows()):\n",
    "    filename = row['Filename']\n",
    "    new_stats = getStats(filename, directed_arc)\n",
    "    total_time += new_stats[4] ###\n",
    "    print(\"Time spent compiling so far: \" + str(total_time))\n",
    "    new_table_row = pandas.DataFrame.from_dict({index : new_stats}, \n",
    "    orient='index', columns=['Size out', 'Depth out', 'CX count out', 'CX depth out','Runtime'])\n",
    "    stat_table = stat_table.append(new_table_row)\n",
    "\n",
    "#stat_table.to_csv(\"BenchmarkTket.csv\") ###Note: uncomment this line to print table to csv.\n",
    "with pandas.option_context('display.max_rows', None):\n",
    "    print(stat_table)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:tket] *",
   "language": "python",
   "name": "conda-env-tket-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
